package com.biodiv.community.exception;


import com.biodiv.community.enums.ErrorEnum;

/**
 * @author tianquan
 */
public class CommunityException extends RuntimeException {
    
    private final int code;
    
    public CommunityException(int code, String message) {
        super(message);
        this.code = code;
    }
    
    public CommunityException(ErrorEnum errorEnum) {
        super(errorEnum.getMessage());
        this.code = errorEnum.getCode();
    }
    
    public CommunityException(ErrorEnum errorEnum, String message) {
        super(message);
        this.code = errorEnum.getCode();
    }
    
    public int getCode() {
        return code;
    }
}
